//
//  XMMemberHeaderView.m
//  XunMi
//
//  Created by MacBook on 2024/3/28.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMMemberHeaderView.h"

@interface XMMemberHeaderView ()
@property (weak, nonatomic) IBOutlet UIButton *dayButton;
@property (weak, nonatomic) IBOutlet UIButton *monthButton;
@property (weak, nonatomic) IBOutlet UIButton *seasonButton;
@property (weak, nonatomic) IBOutlet UIButton *yearButton;
@property (weak, nonatomic) IBOutlet UILabel *timeLa;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *timeTop;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *timeLeft;

@end

@implementation XMMemberHeaderView

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.dayButton setBackgroundImage:[UIImage imageWithColor:UIColor.clearColor] forState:UIControlStateNormal];
    [self.monthButton setBackgroundImage:[UIImage imageWithColor:UIColor.clearColor] forState:UIControlStateNormal];
    [self.seasonButton setBackgroundImage:[UIImage imageWithColor:UIColor.clearColor] forState:UIControlStateNormal];
    [self.yearButton setBackgroundImage:[UIImage imageWithColor:UIColor.clearColor] forState:UIControlStateNormal];
    
    self.dayButton.layer.borderWidth = 1;
    self.dayButton.layer.borderColor = kHEX(@"#161616").CGColor;
    
    self.monthButton.layer.borderWidth = 1;
    self.monthButton.layer.borderColor = kHEX(@"#161616").CGColor;
    
    self.seasonButton.layer.borderWidth = 1;
    self.seasonButton.layer.borderColor = kHEX(@"#161616").CGColor;
    
    self.yearButton.layer.borderWidth = 1;
    self.yearButton.layer.borderColor = kHEX(@"#161616").CGColor;
    
//    self.timeTop.constant = 51 * WIDTH;
//    self.timeLeft.constant = 20 * WIDTH;
}

- (IBAction)changeAction:(UIButton *)sender {
    switch (sender.tag) {
        case 0:
            self.dayButton.selected = YES;
            self.monthButton.selected = NO;
            self.seasonButton.selected = NO;
            self.yearButton.selected = NO;
            break;
            
        case 1:
            self.dayButton.selected = NO;
            self.monthButton.selected = YES;
            self.seasonButton.selected = NO;
            self.yearButton.selected = NO;
            break;
            
        case 2:
            self.dayButton.selected = NO;
            self.monthButton.selected = NO;
            self.seasonButton.selected = YES;
            self.yearButton.selected = NO;
            break;
            
        case 3:
            self.dayButton.selected = NO;
            self.monthButton.selected = NO;
            self.seasonButton.selected = NO;
            self.yearButton.selected = YES;
            break;
            
        default:
            break;
    }
    
}

@end
